package servlet;

import com.alibaba.fastjson.JSON;
import dao.ProvinceDao;
import dao.impl.ProvinceDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ProvinceServlet extends HttpServlet {
	private ProvinceDao pd = new ProvinceDaoImpl();

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("application/json;charset=utf-8");
		response.getWriter().print(JSON.toJSONString(pd.getAllProvinceList()));
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request, response);
	}

}
